package com.leyou.item.client;

import com.leyou.item.pojo.Category;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@RequestMapping("category")
public interface CategoryApi {

    @GetMapping("names")
    List<String> queryNameByIds(@RequestParam("ids") List<Long> ids);

    /**
     * 根据父节点查询商品类目
     * @param pid
     * @return
     */
    @GetMapping("list")
    public ResponseEntity<List<Category>> queryByParentId(@RequestParam(value = "pid", defaultValue = "0") Long pid);

    /**
     * 查询所有一,二,三级分类信息
     * @return
     */
    @GetMapping("listAll")
    List<Category> queryAllCategory() ;

    @RequestMapping("add")
    public void addCategory(Category category);

    @RequestMapping("delete")
    public void deleteCategory(@RequestParam("id") Long id);

    @RequestMapping("edit")
    public void editCategoryByParent(Category category);

    @GetMapping("/bid/{bid}")
    List<Category> findByBrandId(@PathVariable("bid") Long bid);

    /**
     * 根据商品分类Ids查询分类
     * @param ids
     * @return
     */
    @GetMapping("list/ids")
    List<Category> queryCategoryByIds(@RequestParam("ids") List<Long> ids);
    /**
     * 根据3级分类id，查询1~3级的分类
     * @param id
     * @return
     */
    @GetMapping("all/level")
    List<Category> queryAllByCid3(@RequestParam("id") Long id);
    /**
     * 根据3级分类id，查询1~3级的分类
     * @param cid
     * @return
     */
    @GetMapping("all/{cid}")
    List<Category> queryCategoryListChildId(@PathVariable("cid")Long cid);

    @GetMapping("all")
    List<Category> queryAllCategoryList();
}


